package com.woniuxy.exception;

import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @BelongsProject: charging-management-platform
 * @BelongsPackage: com.woniuxy.exception
 * @Author: Quan
 * @Date: 2025/4/7 14:48
 */
@ControllerAdvice
public class GlobalException {

	/**
	 * @Description: 异常切点，参数为指定捕捉异常类
	 * @Param: e - [Exception]
	 * @Author: Quan
	 * @Date: 2025/3/2
	 */
	@ExceptionHandler(Exception.class)
	@ResponseBody
	public ResponseData<?> handleException(Exception e) {
		e.printStackTrace();
		return new ResponseData<>(500, null, "服务器异常，请联系工作人员");
	}
}
